import { Table, Button } from "antd";
import React from "react";
import { Switch } from "antd";
export default function DataTable() {
  const onChange = (checked) => {
    console.log(`switch to ${checked}`);
  };
  const columns = [
    {
      title: "客户类型",
      dataIndex: "name",
      // width: 150,
    },
    {
      title: "负责人员",
      dataIndex: "age",
      // width: 150,
    },
    {
      title: "状态",
      dataIndex: "address",
      render: () => <Switch defaultChecked onChange={onChange} />,
    },
    {
      title: "操作",
      dataIndex: "control",
      render: () => (
        <>
          <Button type="primary">编辑</Button>
          &nbsp;&nbsp;
          <Button type="primary" danger>
            删除
          </Button>
        </>
      ),
    },
  ];
  const data = [];

  for (let i = 0; i < 60; i++) {
    data.push({
      key: i,
      name: `Edward King ${i}`,
      age: 32,
      address: `London, Park Lane no. ${i}`,
    });
  }
  return (
    <>
      <Table
        columns={columns}
        dataSource={data}
        pagination={{
          pageSize: 10,
        }}
        scroll={{
          y: 240,
        }}
      />
    </>
  );
}
